﻿@* Ui层项目 - 树形列表组件文件 *@
@using Util.Generators.Helpers
@model Util.Generators.Contexts.EntityContext
@{
    var service = new GenerateService( Model );
    var description = $"{Model.Description}列表页";
}
import { Component,ChangeDetectionStrategy,Injector } from '@@angular/core';
import { environment } from "@@env/environment";
import { TreeTableQueryComponentBase } from "util-angular";
import { @service.GetClientQueryClassName() } from './model/@service.GetClientQueryFileName()';
import { @service.GetClientViewModelClassName() } from './model/@service.GetClientViewModelFileName()';
import { @service.GetClientEditClassName() } from './@service.GetClientEditFileName()';
import { @service.GetClientDetailClassName() } from './@service.GetClientDetailFileName()';

/**
 * @description
 */
@@Component( {
    selector: '@service.GetClientEntityFileName()-list',
    changeDetection: ChangeDetectionStrategy.OnPush,
    templateUrl: './html/@(service.GetClientListFileName()).html'
})
export class @service.GetClientListClassName() extends TreeTableQueryComponentBase<@service.GetClientViewModelClassName(), @service.GetClientQueryClassName()> {
    /**
     * 获取创建组件
     */
    getCreateComponent() {
        return @service.GetClientEditClassName();
    }

    /**
     * 获取详情组件
     */
    getDetailComponent() {
        return @service.GetClientDetailClassName();
    }

    /**
     * 获取创建标题
     */
    getCreateTitle() {
        return '@service.GetCreateEntityI18nKey()';
    }

    /**
     * 获取更新标题
     */
    getEditTitle() {
        return '@service.GetUpdateEntityI18nKey()';
    }

    /**
     * 获取详情标题
     */
    getDetailTitle() {
        return '@service.GetEntityDetailI18nKey()';
    }

    /**
     * 创建查询参数
     */
    protected createQuery() {
        let result = new @(service.GetClientQueryClassName())();
        return result;
    }

    /**
     * 获取创建数据
     */
    protected getCreateData(data?) {
        return {
            parent: data
        }
    }

    /**
     * 获取更新数据
     */
    protected getEditData(data) {
        if (!data)
            return null;
        return {
            id: data.id,
            data: data
        };
    }
}